import Vue from 'vue'
import App from './App.vue'
import elementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import 'normalize.css'
import './assets/css/base.css'
import router from './router/index'
import store from './store/index'
import { request } from './network/index'



Vue.prototype.$request=request
Vue.use(elementUI)
Vue.config.productionTip = false
router.beforeEach((to, from, next) => {
  if (to.name === 'login') {
    next()
    return
  }
  if (localStorage.getItem('token')) {
    next()
    return
  } else {
    next({
      path:'/login'
    })
  }

})
new Vue({
  render: h => h(App),
  store,
  router
}).$mount('#app')
